﻿using System.Runtime.CompilerServices;

namespace ST_CSharp_多线程
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Program p= new Program();
            p.ByAction();
        }

        private void ByAction()
        {
            Action<string> action = this.DoSomething;
            action.Invoke("A");
            action("B");
            // action.BeginInvoke("我是异步的C", null, null); .net core平台不支持这种调用，.net framework可以使用
            Console.WriteLine("D");
        }

        private void DoSomething(string msg)
        {
            Console.WriteLine(msg);
        }
    }
}